package com.woniu.trader.controller;

import com.woniu.common.utils.ResponseData;
import com.woniu.trader.pojo.Distributor;
import com.woniu.trader.service.DistributorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Description: 
 * @Author:      LiuYang
 * @Date:        2024/11/23 15:37
*/
@RestController
@RequestMapping("/distributor")
   public class DistributorController {
   @Autowired
   private DistributorService distributorService;
   /**
    * 查询所有分销商
    */
   @GetMapping("/queryAll")
   public List<Distributor> queryAll(){
      return distributorService.list();
   }
   /**
    * 根据分销商编号查询分销商
    */
   @GetMapping("/queryByCode/{code}")
   public Distributor queryByCode(@PathVariable("code") String code){
       return distributorService.lambdaQuery().eq(Distributor::getDistributorCode, code).one();
   }
}
